﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DecisionFramework.ServiceProtection
{
    /// <summary>
    /// Provides a sample authorization action that 
    /// authorizes only if the given object equals
    /// "I am authorized".
    /// </summary>
    public class SampleAuthorizationAction : IAuthorizationAction
    {
        /// <summary>
        /// Whether the principal associated with the given security token 
        /// is authorized for the given object.
        /// </summary>
        /// <param name="securityToken"></param>
        /// <param name="obj">The object to check if authorized; can be null.</param>
        /// <returns>Whether the principal associated with the given security token 
        /// is authorized for the given object.
        /// </returns>
        public bool IsAuthorizedFor(string securityToken, object obj)
        {
            return obj != null && obj.Equals("I am authorized");
        }
    }
}
